$(document).ready(function() {
	var rewards = $('#rewards');
	var notes = $('#notes');
	var stats = $('#stats');
	var options = $('#options');
	var debugLog = $('#debugLog');
	
	$('#close').bind('click', function() { window.close(); });
	rewards.bind('click', function() { 
		location.replace('rewards.html');
	});
	notes.bind('click', function() { 
		location.replace('notes.html');
	});
	stats.bind('click', function() { 
		location.replace('stats.html');
	});
	options.bind('click', function() {
		location.replace('options.html');
	});
	globalSettings.getAll(function(setting) {
		if (setting.debug_messages) {
			debugLog.bind('click', function() {
				location.replace('debug.html');
			});
		} else {
			debugLog.hide();
		}
	});
	
	if (location.pathname == '/options.html') {
		options.addClass('selected');
	} else if (location.pathname == '/notes.html') {
		notes.addClass('selected');
	} else if (location.pathname == '/stats.html') {
		stats.addClass('selected');
	} else if (location.pathname == '/rewards.html') {
		rewards.addClass('selected');
	}
});